<template>
    <div>
        <div class="search">
            <input type="text" placeholder="回车搜索商品" @keyup="search">
        </div>
    </div>
</template>

<script>
export default {
    name: 'wgy-search',
    data() {
        return {

        };
    },
    created() {
    },
    methods: {
        search(e) {
            // 如果按下enter把输入的结果，给父组件
            if(e.keyCode === 13){
            // console.log(e.target.value);
            this.$emit('getSearch',e.target.value)
            }
            
        }

    },
    //组件挂载
    components: {},
    //计算属性
    computed: {},
    //过滤器
    filters: {},
};
</script>

<style lang="scss" scoped>
.search{
    width: 100%;
    border-bottom: 1px solid #ccc;
    height: .8rem;
    background-color: #fff;
    position: relative;
    input{
        position: absolute;
        top: .2rem;
        background-color: #eee;
        width: 4.5rem;
        border-radius: .4rem ;
        height: .5rem;
        border: none;
        margin-left: .4rem;
        outline: none;
        padding-left: .4rem;
    }
}
</style>
